Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Orientation listener in bridgeless mode #43971

Closed
wants to merge 1 commit into from

Conversation

cipolleschi
Copy link
Contributor

Summary:
It turns out that we forgot to add a listener for the orientation change event in Bridgeless.

We used to have UIApplicationDidChangeStatusBarOrientationNotification but this is slightly unreliable because there might be use cases where the status bar has been hidden and, therefore, the event is not triggered.

This should fix an issue reported by OSS.

Changelog:

[iOS][Fixed] - Make sure that the New Architecture listens to orientation change events.

Differential Revision: D55871599

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Apr 8, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55871599

Summary:

It turns out that we forgot to add a listener for the orientation change event in Bridgeless.

We used to have `UIApplicationDidChangeStatusBarOrientationNotification` but this is slightly unreliable because there might be use cases where the status bar has been hidden and, therefore, the event is not triggered.

This should fix an issue reported by OSS.

## Changelog:
[iOS][Fixed] - Make sure that the New Architecture listens to orientation change events.

Differential Revision: D55871599
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55871599

@cipolleschi
Copy link
Contributor Author

Also... UIApplicationDidChangeStatusBarOrientationNotification is deprecated

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Apr 9, 2024
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 49b0d26.

Copy link

github-actions bot commented Apr 9, 2024

This pull request was successfully merged by @cipolleschi in 49b0d26.

When will my fix make it into a release? | How to file a pick request?

cortinico pushed a commit that referenced this pull request Apr 9, 2024
Summary:
Pull Request resolved: #43971

It turns out that we forgot to add a listener for the orientation change event in Bridgeless.

We used to have `UIApplicationDidChangeStatusBarOrientationNotification` but this is slightly unreliable because there might be use cases where the status bar has been hidden and, therefore, the event is not triggered.

This should fix an issue reported by OSS.

## Changelog:
[iOS][Fixed] - Make sure that the New Architecture listens to orientation change events.

Reviewed By: cortinico

Differential Revision: D55871599

fbshipit-source-id: c9b0634ec2126aa7a6488c2c56c87a9610fa1adf
@@ -75,6 +75,10 @@ - (void)initialize
selector:@selector(interfaceFrameDidChange)
name:RCTWindowFrameDidChangeNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(interfaceFrameDidChange)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cipolleschi Should that really be calling interfaceFrameDidChange and not interfaceOrientationDidChange instead? I'm currently investigating an issue on 0.74.1, where orientation changes are not propagated correctly by Dimensions and/or useWindowDimensions and the culprit seems to be that nothing updates the dimensions properly on orientation change.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, after some more debugging - [self _exportedDimensions] is always returning the previous dimension prior the orientation change, so the portrait dimensions when switching to landscape and vice versa. Is this related when the UIDeviceOrientationDidChangeNotification event is triggered or related to when we gather the dimension data?

Copy link

@MegaMaddin MegaMaddin May 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe related: https://snippet.zone/2022/11/
As well as: https://forums.developer.apple.com/forums/thread/713072

TL;DR it seems that the update of the bounds is not immediate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants